home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 2.0a3 / Universal AIncludes / Printing.a < prev    next >
Encoding:
Text File  |  1994-11-11  |  11.3 KB  |  567 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Printing.a
  3. ;
  4. ;    Copyright:    © 1984-1994 by Apple Computer, Inc.
  5. ;                All rights reserved.
  6. ;
  7. ;    Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8. ;
  9. ;    Bugs?:        If you find a problem with this file, send the file and version
  10. ;                information (from above) and the problem description to:
  11. ;
  12. ;                    Internet:    apple.bugs@applelink.apple.com
  13. ;                    AppleLink:    APPLE.BUGS
  14. ;
  15. ;
  16.  
  17.     IF &TYPE('__PRINTING__') = 'UNDEFINED' THEN
  18. __PRINTING__ SET 1
  19.  
  20.  
  21.     IF &TYPE('__ERRORS__') = 'UNDEFINED' THEN
  22.     include 'Errors.a'
  23.     ENDIF
  24. ;        include 'ConditionalMacros.a'                                ;
  25.  
  26.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  27.     include 'Quickdraw.a'
  28.     ENDIF
  29. ;        include 'Types.a'                                            ;
  30. ;        include 'MixedMode.a'                                        ;
  31. ;        include 'QuickdrawText.a'                                    ;
  32.  
  33.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  34.     include 'Dialogs.a'
  35.     ENDIF
  36. ;        include 'Memory.a'                                            ;
  37. ;        include 'Windows.a'                                        ;
  38. ;            include 'Events.a'                                        ;
  39. ;                include 'OSUtils.a'                                ;
  40. ;            include 'Controls.a'                                    ;
  41. ;                include 'Menus.a'                                    ;
  42. ;        include 'TextEdit.a'                                        ;
  43.  
  44. iPFMaxPgs                        EQU        128
  45. iPrPgFract                        EQU        120                    ;Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract
  46. iPrPgFst                        EQU        1                    ;Page range constants
  47. iPrPgMax                        EQU        9999
  48. iPrRelease                        EQU        3                    ;Current version number of the code.
  49. iPrSavPFil                        EQU        -1
  50. iPrAbort                        EQU        $0080
  51. iPrDevCtl                        EQU        7                    ;The PrDevCtl Proc's ctl number
  52. lPrReset                        EQU        $00010000            ;The PrDevCtl Proc's CParam for reset
  53. lPrLineFeed                        EQU        $00030000
  54. lPrLFStd                        EQU        $0003FFFF            ;The PrDevCtl Proc's CParam for std paper advance
  55. lPrLFSixth                        EQU        $0003FFFF
  56. lPrPageEnd                        EQU        $00020000            ;The PrDevCtl Proc's CParam for end page
  57. lPrDocOpen                        EQU        $00010000
  58. lPrPageOpen                        EQU        $00040000
  59. lPrPageClose                    EQU        $00020000
  60. lPrDocClose                        EQU        $00050000
  61. iFMgrCtl                        EQU        8                    ;The FMgr's Tail-hook Proc's ctl number
  62. iMscCtl                            EQU        9                    ;The FMgr's Tail-hook Proc's ctl number
  63. iPvtCtl                            EQU        10                    ;The FMgr's Tail-hook Proc's ctl number
  64.  
  65. pPrGlobals                        EQU        $00000944            ;The PrVars lo mem area:
  66. bDraftLoop                        EQU        0
  67. bSpoolLoop                        EQU        1
  68. bUser1Loop                        EQU        2
  69. bUser2Loop                        EQU        3
  70. fNewRunBit                        EQU        2
  71. fHiResOK                        EQU        3
  72. fWeOpenedRF                        EQU        4
  73. ;Driver constants 
  74. iPrBitsCtl                        EQU        4
  75. lScreenBits                        EQU        0
  76. lPaintBits                        EQU        1
  77. lHiScreenBits                    EQU        $00000002            ;The Bitmap Print Proc's Screen Bitmap param
  78. lHiPaintBits                    EQU        $00000003            ;The Bitmap Print Proc's Paint [sq pix] param
  79. iPrIOCtl                        EQU        5
  80. iPrEvtCtl                        EQU        6                    ;The PrEvent Proc's ctl number
  81. lPrEvtAll                        EQU        $0002FFFD            ;The PrEvent Proc's CParam for the entire screen
  82. lPrEvtTop                        EQU        $0001FFFD            ;The PrEvent Proc's CParam for the top folder
  83. iPrDrvrRef                        EQU        -3
  84.  
  85. getRslDataOp                    EQU        4
  86. setRslOp                        EQU        5
  87. draftBitsOp                        EQU        6
  88. noDraftBitsOp                    EQU        7
  89. getRotnOp                        EQU        8
  90. NoSuchRsl                        EQU        1
  91. OpNotImpl                        EQU        2                    ;the driver doesn't support this opcode
  92. RgType1                            EQU        1
  93.  
  94. feedCut                            EQU        0
  95. feedFanfold                        EQU        1
  96. feedMechCut                        EQU        2
  97. feedOther                        EQU        3
  98.  
  99. scanTB                            EQU        0
  100. scanBT                            EQU        1
  101. scanLR                            EQU        2
  102. scanRL                            EQU        3
  103.  
  104. ; A Rect Ptr 
  105. TPrPort                 RECORD    0
  106. gPort                     ds        GrafPort                            ;The Printer's graf port.
  107. gProcs                     ds        QDProcs                            ;..and its procs
  108. lGParam1                 ds.l    1                                    ;16 bytes for private parameter storage.
  109. lGParam2                 ds.l    1
  110. lGParam3                 ds.l    1
  111. lGParam4                 ds.l    1
  112. fOurPtr                     ds.b    1                                    ;Whether the PrPort allocation was done by us.
  113. fOurBits                 ds.b    1                                    ;Whether the BitMap allocation was done by us.
  114. sizeof                     EQU    178
  115.                         ENDR
  116.  
  117. ; Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  118. ;  This is the "PrPeek" record. 
  119. TPrInfo                 RECORD    0
  120. iDev                     ds.w    1                                    ;Font mgr/QuickDraw device code
  121. iVRes                     ds.w    1                                    ;Resolution of device, in device coordinates
  122. iHRes                     ds.w    1                                    ;..note: V before H => compatable with Point.
  123. rPage                     ds        Rect                                ;The page (printable) rectangle in device coordinates.
  124. sizeof                     EQU    14
  125.                         ENDR
  126.  
  127. ; Print Info Record: The parameters needed for page composition. 
  128. TPrStl                     RECORD    0
  129. wDev                     ds.w    1
  130. iPageV                     ds.w    1
  131. iPageH                     ds.w    1
  132. bPort                     ds.b    1
  133. feed                     ds.b    1
  134. sizeof                     EQU    8
  135.                         ENDR
  136.  
  137. TPrXInfo                 RECORD    0
  138. iRowBytes                 ds.w    1
  139. iBandV                     ds.w    1
  140. iBandH                     ds.w    1
  141. iDevBytes                 ds.w    1
  142. iBands                     ds.w    1
  143. bPatScale                 ds.b    1
  144. bUlThick                 ds.b    1
  145. bUlOffset                 ds.b    1
  146. bUlShadow                 ds.b    1
  147. scan                     ds.b    1
  148. bXInfoX                     ds.b    1
  149. sizeof                     EQU    16
  150.                         ENDR
  151.  
  152. TPrJob                     RECORD    0
  153. iFstPage                 ds.w    1                                    ;Page Range.
  154. iLstPage                 ds.w    1
  155. iCopies                     ds.w    1                                    ;No. copies.
  156. bJDocLoop                 ds.b    1                                    ;The Doc style: Draft, Spool, .., and ..
  157. fFromUsr                 ds.b    1                                    ;Printing from an User's App (not PrApp) flag
  158. pIdleProc                 ds.l    1                                    ;The Proc called while waiting on IO etc.
  159. pFileName                 ds.l    1                                    ;Spool File Name: NIL for default.
  160. iFileVol                 ds.w    1                                    ;Spool File vol, set to 0 initially
  161. bFileVers                 ds.b    1                                    ;Spool File version, set to 0 initially
  162. bJobX                     ds.b    1                                    ;An eXtra byte.
  163. sizeof                     EQU    20
  164.                         ENDR
  165.  
  166. ; Print Job: Print "form" for a single print request. 
  167. ; The universal 120 byte printing record 
  168. TPrStatus                 RECORD    0
  169. iTotPages                 ds.w    1                                    ;Total pages in Print File.
  170. iCurPage                 ds.w    1                                    ;Current page number
  171. iTotCopies                 ds.w    1                                    ;Total copies requested
  172. iCurCopy                 ds.w    1                                    ;Current copy number
  173. iTotBands                 ds.w    1                                    ;Total bands per page.
  174. iCurBand                 ds.w    1                                    ;Current band number
  175. fPgDirty                 ds.b    1                                    ;True if current page has been written to.
  176. fImaging                 ds.b    1                                    ;Set while in band's DrawPic call.
  177. hPrint                     ds.l    1                                    ;Handle to the active Printer record
  178. pPrPort                     ds.l    1                                    ;Ptr to the active PrPort
  179. hPic                     ds.l    1                                    ;Handle to the active Picture
  180. sizeof                     EQU    26
  181.                         ENDR
  182.  
  183. ; Print Status: Print information during printing. 
  184. TPfPgDir                 RECORD    0
  185. iPages                     ds.w    1
  186. iPgPos                     ds.l    129                                ;ARRAY [0..iPfMaxPgs] OF LONGINT
  187. sizeof                     EQU    518
  188.                         ENDR
  189.  
  190. ; PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) 
  191. TPrDlg                     RECORD    0
  192. Dlg                         ds        DialogRecord                        ;The Dialog window
  193. pFltrProc                 ds.l    1                                    ;The Filter Proc.
  194. pItemProc                 ds.l    1                                    ;The Item evaluating proc.
  195. hPrintUsr                 ds.l    1                                    ;The user's print record.
  196. fDoIt                     ds.b    1
  197. fDone                     ds.b    1
  198. lUser1                     ds.l    1                                    ;Four longs for user's to hang global data.
  199. lUser2                     ds.l    1                                    ;...Plus more stuff needed by the particular printing dialog.
  200. lUser3                     ds.l    1
  201. lUser4                     ds.l    1
  202. sizeof                     EQU    200
  203.                         ENDR
  204.  
  205. ; This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  206. ;Print Dialog: The Dialog Stream object. 
  207. TGnlData                 RECORD    0
  208. iOpCode                     ds.w    1
  209. iError                     ds.w    1
  210. lReserved                 ds.l    1                                    ;more fields here depending on call
  211. sizeof                     EQU    8
  212.                         ENDR
  213.  
  214. TRslRg                     RECORD    0
  215. iMin                     ds.w    1
  216. iMax                     ds.w    1
  217. sizeof                     EQU    4
  218.                         ENDR
  219.  
  220. TRslRec                 RECORD    0
  221. iXRsl                     ds.w    1
  222. iYRsl                     ds.w    1
  223. sizeof                     EQU    4
  224.                         ENDR
  225.  
  226. TGetRslBlk                 RECORD    0
  227. iOpCode                     ds.w    1
  228. iError                     ds.w    1
  229. lReserved                 ds.l    1
  230. iRgType                     ds.w    1
  231. xRslRg                     ds        TRslRg
  232. yRslRg                     ds        TRslRg
  233. iRslRecCnt                 ds.w    1
  234. rgRslRec                 ds.b    27 * TRslRec
  235. sizeof                     EQU    128
  236.                         ENDR
  237.  
  238. TSetRslBlk                 RECORD    0
  239. iOpCode                     ds.w    1
  240. iError                     ds.w    1
  241. lReserved                 ds.l    1
  242. hPrint                     ds.l    1
  243. iXRsl                     ds.w    1
  244. iYRsl                     ds.w    1
  245. sizeof                     EQU    16
  246.                         ENDR
  247.  
  248. TDftBitsBlk             RECORD    0
  249. iOpCode                     ds.w    1
  250. iError                     ds.w    1
  251. lReserved                 ds.l    1
  252. hPrint                     ds.l    1
  253. sizeof                     EQU    12
  254.                         ENDR
  255.  
  256. TGetRotnBlk             RECORD    0
  257. iOpCode                     ds.w    1
  258. iError                     ds.w    1
  259. lReserved                 ds.l    1
  260. hPrint                     ds.l    1
  261. fLandscape                 ds.b    1
  262. bXtra                     ds.b    1
  263. sizeof                     EQU    14
  264.                         ENDR
  265.  
  266.     IF GENERATING68K THEN
  267.         Macro
  268.         _PrPurge
  269.             dc.w     $2F3C
  270.             dc.w     $A800
  271.             dc.w     $0000
  272.             dc.w     $A8FD
  273.         EndM
  274.     ELSE
  275.         IMPORT    PrPurge
  276.     ENDIF
  277.  
  278.     IF GENERATING68K THEN
  279.         Macro
  280.         _PrNoPurge
  281.             dc.w     $2F3C
  282.             dc.w     $B000
  283.             dc.w     $0000
  284.             dc.w     $A8FD
  285.         EndM
  286.     ELSE
  287.         IMPORT    PrNoPurge
  288.     ENDIF
  289.  
  290.     IF GENERATING68K THEN
  291.         Macro
  292.         _PrOpen
  293.             dc.w     $2F3C
  294.             dc.w     $C800
  295.             dc.w     $0000
  296.             dc.w     $A8FD
  297.         EndM
  298.     ELSE
  299.         IMPORT    PrOpen
  300.     ENDIF
  301.  
  302.     IF GENERATING68K THEN
  303.         Macro
  304.         _PrClose
  305.             dc.w     $2F3C
  306.             dc.w     $D000
  307.             dc.w     $0000
  308.             dc.w     $A8FD
  309.         EndM
  310.     ELSE
  311.         IMPORT    PrClose
  312.     ENDIF
  313.  
  314.     IF GENERATING68K THEN
  315.         Macro
  316.         _PrintDefault
  317.             dc.w     $2F3C
  318.             dc.w     $2004
  319.             dc.w     $0480
  320.             dc.w     $A8FD
  321.         EndM
  322.     ELSE
  323.         IMPORT    PrintDefault
  324.     ENDIF
  325.  
  326.     IF GENERATING68K THEN
  327.         Macro
  328.         _PrValidate
  329.             dc.w     $2F3C
  330.             dc.w     $5204
  331.             dc.w     $0498
  332.             dc.w     $A8FD
  333.         EndM
  334.     ELSE
  335.         IMPORT    PrValidate
  336.     ENDIF
  337.  
  338.     IF GENERATING68K THEN
  339.         Macro
  340.         _PrStlDialog
  341.             dc.w     $2F3C
  342.             dc.w     $2A04
  343.             dc.w     $0484
  344.             dc.w     $A8FD
  345.         EndM
  346.     ELSE
  347.         IMPORT    PrStlDialog
  348.     ENDIF
  349.  
  350.     IF GENERATING68K THEN
  351.         Macro
  352.         _PrJobDialog
  353.             dc.w     $2F3C
  354.             dc.w     $3204
  355.             dc.w     $0488
  356.             dc.w     $A8FD
  357.         EndM
  358.     ELSE
  359.         IMPORT    PrJobDialog
  360.     ENDIF
  361.  
  362.     IF GENERATING68K THEN
  363.         Macro
  364.         _PrStlInit
  365.             dc.w     $2F3C
  366.             dc.w     $3C04
  367.             dc.w     $040C
  368.             dc.w     $A8FD
  369.         EndM
  370.     ELSE
  371.         IMPORT    PrStlInit
  372.     ENDIF
  373.  
  374.     IF GENERATING68K THEN
  375.         Macro
  376.         _PrJobInit
  377.             dc.w     $2F3C
  378.             dc.w     $4404
  379.             dc.w     $0410
  380.             dc.w     $A8FD
  381.         EndM
  382.     ELSE
  383.         IMPORT    PrJobInit
  384.     ENDIF
  385.  
  386.     IF GENERATING68K THEN
  387.         Macro
  388.         _PrJobMerge
  389.             dc.w     $2F3C
  390.             dc.w     $5804
  391.             dc.w     $089C
  392.             dc.w     $A8FD
  393.         EndM
  394.     ELSE
  395.         IMPORT    PrJobMerge
  396.     ENDIF
  397.  
  398.     IF GENERATING68K THEN
  399.         Macro
  400.         _PrDlgMain
  401.             dc.w     $2F3C
  402.             dc.w     $4A04
  403.             dc.w     $0894
  404.             dc.w     $A8FD
  405.         EndM
  406.     ELSE
  407.         IMPORT    PrDlgMain
  408.     ENDIF
  409.  
  410.     IF GENERATING68K THEN
  411.         Macro
  412.         _PrOpenDoc
  413.             dc.w     $2F3C
  414.             dc.w     $0400
  415.             dc.w     $0C00
  416.             dc.w     $A8FD
  417.         EndM
  418.     ELSE
  419.         IMPORT    PrOpenDoc
  420.     ENDIF
  421.  
  422.     IF GENERATING68K THEN
  423.         Macro
  424.         _PrCloseDoc
  425.             dc.w     $2F3C
  426.             dc.w     $0800
  427.             dc.w     $0484
  428.             dc.w     $A8FD
  429.         EndM
  430.     ELSE
  431.         IMPORT    PrCloseDoc
  432.     ENDIF
  433.  
  434.     IF GENERATING68K THEN
  435.         Macro
  436.         _PrOpenPage
  437.             dc.w     $2F3C
  438.             dc.w     $1000
  439.             dc.w     $0808
  440.             dc.w     $A8FD
  441.         EndM
  442.     ELSE
  443.         IMPORT    PrOpenPage
  444.     ENDIF
  445.  
  446.     IF GENERATING68K THEN
  447.         Macro
  448.         _PrClosePage
  449.             dc.w     $2F3C
  450.             dc.w     $1800
  451.             dc.w     $040C
  452.             dc.w     $A8FD
  453.         EndM
  454.     ELSE
  455.         IMPORT    PrClosePage
  456.     ENDIF
  457.  
  458.     IF GENERATING68K THEN
  459.         Macro
  460.         _PrPicFile
  461.             dc.w     $2F3C
  462.             dc.w     $6005
  463.             dc.w     $1480
  464.             dc.w     $A8FD
  465.         EndM
  466.     ELSE
  467.         IMPORT    PrPicFile
  468.     ENDIF
  469.  
  470.     IF GENERATING68K THEN
  471.         Macro
  472.         _PrError
  473.             dc.w     $2F3C
  474.             dc.w     $BA00
  475.             dc.w     $0000
  476.             dc.w     $A8FD
  477.         EndM
  478.     ELSE
  479.         IMPORT    PrError
  480.     ENDIF
  481.  
  482.     IF GENERATING68K THEN
  483.         Macro
  484.         _PrSetError
  485.             dc.w     $2F3C
  486.             dc.w     $C000
  487.             dc.w     $0200
  488.             dc.w     $A8FD
  489.         EndM
  490.     ELSE
  491.         IMPORT    PrSetError
  492.     ENDIF
  493.  
  494.     IF GENERATING68K THEN
  495.         Macro
  496.         _PrGeneral
  497.             dc.w     $2F3C
  498.             moveq    #7,d0
  499.             dc.w     $0480
  500.             dc.w     $A8FD
  501.         EndM
  502.     ELSE
  503.         IMPORT    PrGeneral
  504.     ENDIF
  505.  
  506.     IF GENERATING68K THEN
  507.         Macro
  508.         _PrDrvrOpen
  509.             dc.w     $2F3C
  510.             dc.w     $8000
  511.             dc.w     $0000
  512.             dc.w     $A8FD
  513.         EndM
  514.     ELSE
  515.         IMPORT    PrDrvrOpen
  516.     ENDIF
  517.  
  518.     IF GENERATING68K THEN
  519.         Macro
  520.         _PrDrvrClose
  521.             dc.w     $2F3C
  522.             dc.w     $8800
  523.             dc.w     $0000
  524.             dc.w     $A8FD
  525.         EndM
  526.     ELSE
  527.         IMPORT    PrDrvrClose
  528.     ENDIF
  529.  
  530.     IF GENERATING68K THEN
  531.         Macro
  532.         _PrCtlCall
  533.             dc.w     $2F3C
  534.             dc.w     $A000
  535.             dc.w     $0E00
  536.             dc.w     $A8FD
  537.         EndM
  538.     ELSE
  539.         IMPORT    PrCtlCall
  540.     ENDIF
  541.  
  542.     IF GENERATING68K THEN
  543.         Macro
  544.         _PrDrvrDCE
  545.             dc.w     $2F3C
  546.             dc.w     $9400
  547.             dc.w     $0000
  548.             dc.w     $A8FD
  549.         EndM
  550.     ELSE
  551.         IMPORT    PrDrvrDCE
  552.     ENDIF
  553.  
  554.     IF GENERATING68K THEN
  555.         Macro
  556.         _PrDrvrVers
  557.             dc.w     $2F3C
  558.             dc.w     $9A00
  559.             dc.w     $0000
  560.             dc.w     $A8FD
  561.         EndM
  562.     ELSE
  563.         IMPORT    PrDrvrVers
  564.     ENDIF
  565.  
  566.     ENDIF ; __PRINTING__
  567.